<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="pg" uri="http://jsptags.com/tags/navigation/pager"%>

<%@ include file="/header.jsp" %>

<style>
* {font-family: "楷体";font-size: 18px}
</style>
<center>
<div align="right" style="width: 800">
	<c:if test="${!empty loginUser}">
	        登录名：${loginUser.username} &nbsp;&nbsp;&nbsp;&nbsp;
	    <a href="${ctx}/user/editUserPassword.jsp">修改密码</a>
	    <a href="${ctx}/user/manager?func=logout">退出</a>
	    <br>
        <center> 
	    <a href="${ctx}/message/addMessage.jsp">添加留言</a>&nbsp;&nbsp;&nbsp;&nbsp;
	    <c:if test="${msg=='all'}">
	    	<a href="${ctx}/message/manager?msg=my">我的留言</a>&nbsp;&nbsp;&nbsp;&nbsp;
	    </c:if>


	    <c:if test="${msg!='all'}">
	    	<a href="${ctx}/message/manager?msg=all">所有留言</a>&nbsp;&nbsp;&nbsp;&nbsp;
	    </c:if>
	    <c:if test="${loginUser.roleId==1}">
	    <a href="${ctx}/user/manager">用户管理</a>
	    </c:if>
        </center> 
	</c:if>
	<c:if test="${empty loginUser}">
	    <a href="${ctx}/user/login.jsp">登录</a>
	    <a href="${ctx}/user/register.jsp">注册</a>
	</c:if>
	<br>
</div>
</center>

<div align="center" style="width:600">
</div>
<center>
	留言内容<br>
	<br>
	<c:forEach items="${page.data}" var="obj">
	<table border="0" style="width: 600; fixed; word-break: break-all;border-color:blue;">
		<tr>
			<td width="100" bordercolor="ffffff">编号:</td>
			<td width="500" bordercolor="ffffff">${obj.id}</td>
		</tr>
		<tr>
			<td bordercolor="ffffff">姓名:</td>
			<td bordercolor="ffffff">${obj.name}</td>
		</tr>
		<tr>
			<td bordercolor="ffffff">主题:</td>
			<td bordercolor="ffffff">${obj.title}</td>
		</tr>
		<tr>
			<td valign="top" bordercolor="ffffff">内容:</td>
			<td valign="top" bordercolor="ffffff">${obj.content}</td>
		</tr>
		<tr> 
			<td bordercolor="ffffff">时间:</td>
			<td bordercolor="ffffff">${obj.time}</td>
		</tr>
		<c:if test="${loginUser.username==obj.name || loginUser.roleId==1}">
		<tr>
			<td bordercolor="ffffff">操作:</td>
			<td bordercolor="ffffff">
			<a href="${ctx}/message/manager?func=edit&id=${obj.id}">修改</a>
			<a href="${ctx}/message/manager?func=delete&id=${obj.id}">删除</a>
			</td>
		</tr>
		</c:if>
	</table>
	<br>
	</c:forEach>
    <pg:pager url="${ctx}/message/manager"	items="${page.maxRows}"	maxPageItems="${page.pageSize}"  maxIndexPages="5">		
    	<pg:index>
			<pg:first unless="current">
				<a href="${pageUrl}&pageNumber=${pageNumber}">首页</a>
			</pg:first >
			<pg:prev>
				<a href="${pageUrl}&pageNumber=${pageNumber}">上一页(${pageNumber})</a>
			</pg:prev>
			<pg:pages>
				<a href="${pageUrl}&pageNumber=${pageNumber}">${pageNumber}</a>			
			</pg:pages>
			<pg:next>
				<a href="${pageUrl}&pageNumber=${pageNumber}">下一页(${pageNumber})</a>
			</pg:next>
			<pg:last unless="current">
				<a href="${pageUrl}&pageNumber=${pageNumber}">尾页</a>
			</pg:last>
			
		</pg:index>
	</pg:pager>
</center>

